<?php
// +----------------------------------------------------------------------
// | 海豚PHP框架 [ DolphinPHP ]
// +----------------------------------------------------------------------
// | 版权所有 2016~2017 河源市卓锐科技有限公司 [ http://www.zrthink.com ]
// +----------------------------------------------------------------------
// | 官方网站: http://dolphinphp.com
// +----------------------------------------------------------------------
// | 开源协议 ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------

namespace app\warehouse\validate;

use think\Validate;

/**
 * 运费配置验证器
 * @package app\warehouse\validate
 * @author 陈梦晨 <2391157750@qq.com>
 */
class Freight extends Validate
{
    //定义验证规则
    protected $rule = [
        'warehouseid' => 'require',
        'provinceid' => 'require',
        'cityid' => 'require',
        'carrierid' => 'require',
        'ykg|首重' =>'require|float',
        'ykgfee|首重资费' =>'require|float',
        'continued|续重' =>'require|float',
        'continuedfee|续重资费' =>'require|float',
        'aging|时效' =>'require|number',
        'freight_unique' => 'unique:warehouse_freight,warehouseid^provinceid^cityid^townid^carrierid^distributeid',
    ];

    //定义验证提示
    protected $message = [
        'warehouseid.require' => '请选择仓库',
        'provinceid.require' => '请选择省/市',
        'cityid.require' => '请选择市/区',
        'carrierid.require' => '请选择承运商',
        'freight_unique'=>'该条件下运费方式已经设置',
    ];
}
